
package com.rt.schedulenew.core.config;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;

import java.util.concurrent.TimeUnit;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AppCacheConfig {
    private static final int EXPIRE_SECONDS = 86400;

    @Bean
    public LoadingCache<String, Object> myCacheStorage() {
        LoadingCache<String, Object> build = CacheBuilder.newBuilder().maximumSize(3000L)
                .expireAfterWrite(EXPIRE_SECONDS, TimeUnit.SECONDS)
                .build(new CacheLoader<String, Object>() {
                    public Object load(String name) throws Exception {
                        return "";
                    }
                });
        return build;
    }
}
